import {
	EditView2ActionType,
	IEditView2Ability,
	IEditView2ControllerParams,
	IEditView2Model,
	IEditView2Store,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取编辑视图2输入参数
 *
 * @export
 * @return {*}
 */
export function useEditView2Props() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取编辑视图2基础
 *
 * @export
 * @param {IEditView2Model} model 编辑视图2模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useEditView2Basic(model: IEditView2Model, props: IParam) {
	const getClassNames = (props: IParam) => {
		return getViewClassNames(model, props);
	};
	return {
		...useViewBasic(model, props),
		getClassNames,
	};
}

/**
 * 编辑视图2行为
 *
 * @export
 */
export function useEditView2Action(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取编辑视图2控制器输入参数
 *
 * @export
 * @param {IEditView2Model} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<EditView2ActionType, IEditView2Ability>>} evt
 * @return {*}  {IEditView2ControllerParams<EditView2ActionType, IEditView2Ability>}
 */
export function useEditView2ControllerParams(
	model: IEditView2Model,
	props: IParam,
	evt: QXEvent<IViewEvent<EditView2ActionType, IEditView2Ability>>
): IEditView2ControllerParams<EditView2ActionType, IEditView2Ability> {
	return {
		...useViewControllerParams<IEditView2Store, IEditView2Model>(
			model,
			props,
			evt
		),
	};
}
